<template>
  <div>
    {{ firstName }} {{ lastName }}
    <button @click="onClickHandler">我是Test组件中的button</button>
  </div>
</template>
<script lang="ts">
export default {
  props: ["firstName", "lastName"],
  // emits: ["onFirstNameChanged"],
  setup(props, { emit }) {
    const onClickHandler = () => {
      // 升级版
      // 触发父组件自定义事件
      // emit("onFirstNameChanged", "王五");

      // 终极版
      emit("update:firstName", "liubei");
      emit("update:lastName", "zhugeliang");
    };
    return { onClickHandler };
  },
};
</script>
